<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Hello World</title>
  <script src="https://unpkg.com/vue"></script>
</head>

<body>
  <div id="root"></div>
  <script>
    Vue.createApp({
      template: `<div>
        {{str}}
        <button @click="reverseStr">反转</button>
      </div>`,
      data() {
        return {
          str: 'Hello world'
        }
      },
      methods: {
        reverseStr(){
          this.str = this.str.split('').reverse().join('')
        }
      }
    }).mount('#root');
  </script>
</body>

</html>